/*
 * FileDescriptor.h
 *
 *  Created on: 26/06/2014
 *      Author: Vitor
 */

#ifndef FILEDESCRIPTOR_H_
#define FILEDESCRIPTOR_H_

#include "FileSystemElement.h"
#include <string>
#include <stdio.h>

class FileDescriptor: public FileSystemElement {
private:
	unsigned int location;
	unsigned int copy_location;
	unsigned int size;

public:
	FileDescriptor(std::string name, unsigned int location,
			unsigned int copy_location, unsigned int size);
	virtual ~FileDescriptor();

	void rename(std::string old_full_path, std::string new_full_path) {
		name.replace(name.find(old_full_path), old_full_path.length(),
				new_full_path);
	}

	void print() {
		printf("Location: %x -  Copy location: %x - Arquivo: %s\n", location,
				copy_location, name.c_str());
	}

	unsigned int get_location() {
		return location;
	}

	unsigned int get_copy_location() {
		return copy_location;
	}

	void set_location(unsigned int location) {
		this->location = location;
	}

	void set_copy_location(unsigned int location) {
		this->copy_location = location;
	}

	unsigned int get_size() {
		return size;
	}

	std::string html_encoding();

	ByteQueue serialize();
};

#endif /* FILEDESCRIPTOR_H_ */
